#include <iostream>
#include <typeinfo>

class Base {
    virtual void func() {}
};
class Derived : public Base {};

int main() {
    try {
        throw std::runtime_error("Error");  // 会报错
    } catch (...) {
        std::cout << "Caught an exception\n";
    }

    Base *b = new Derived();
    if (typeid(*b) == typeid(Derived)) {  // 会报错
        std::cout << "Derived type\n";
    }

    return 0;
}